package cn.openea.perpartner.meily.web.mapper;

import cn.openea.perpartner.meily.web.entity.RevenueRecordsArc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * @author ysk
 * @email zane_ysk@qq.com
 * @date 2023-03-22 10:59:41
 */
@Mapper
public interface RevenueRecordsArcMapper extends BaseMapper<RevenueRecordsArc> {

    @Select("SELECT SUM(CAST(accumulated_income AS DECIMAL(10,2))) FROM meily_revenue_records_arc WHERE DATE_FORMAT(settlement_date,'%Y-%m') = #{timePeriod}")
    BigDecimal countCumulative(@Param("timePeriod") String timePeriod);
}
